package com.wuyou.designPatterns.flyweight;

import com.wuyou.utils.FileUtils;

import java.io.*;

/**
 * 用来表示"大型字符"
 *
 * @Date 2024/10/18 10:53
 * @Author 无忧
 */
public class BigChar {

    private char charName;

    private String fontData;

    public BigChar(char charName){
        this.charName = charName;

        try {
            BufferedReader reader = new BufferedReader(
                    new FileReader(FileUtils.getClassDir(this.getClass())+"file"+File.separator+"big"+charName+".txt"));
            String line;
            StringBuffer buf = new StringBuffer();
            while ((line = reader.readLine()) != null) {
                buf.append(line);
                buf.append("\n");
            }
            reader.close();
            this.fontData = buf.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void print(){
        System.out.println(fontData);
    }
}
